package JDBC;

public class RegDemo {
    public static void main(String[] args) throws Exception {
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("输入用户:");
//        String username = scanner.nextLine();
////        username = "'"+username+"'";
//        System.out.println("输入密码");
//        String password = scanner.nextLine();
////        password = "'"+password+"'";
//        System.out.println("输入昵称");
//        String nickname = scanner.nextLine();
////        nickname = "'"+nickname+"'";
//        System.out.println("输入年龄");
////        int age = scanner.nextInt();
//        int age = Integer.parseInt(scanner.nextLine());


        UserInfo userInfo = InputUtil.getInputObject(new UserInfo(),"欢迎注册","注册");
        System.out.println(userInfo);

//        Class.forName("com.mysql.cj.jdbc.Driver");
//
//        Connection connection = DriverManager.getConnection(
//                "jdbc:mysql://localhost:3307/tedu?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true",
//                "root",
//                "root");
//        System.out.println("与数据库建立连接");


//        Statement statement = connection.createStatement();
//        String sql="INSERT INTO userinfo(username,password,nickname,age) " +
//                "VALUES ('"+username+"','"+password+"','"+nickname+"',"+age+");";
//
//        //"+username+","+password+","+nickname+","+age+"
//        System.out.println(sql);
//        int num = statement.executeUpdate(sql);
//        if(num>0){
//            System.out.println("插入成功");
//        }
//        connection.close();
    }
}
